﻿<UserControl x:Class="Ewav.Scatter"
	 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:GadgetSelector="clr-namespace:Ewav.ContextMenu;assembly=Ewav.ContextMenu.Menu"
	xmlns:Common="clr-namespace:CommonLibrary;assembly=CommonLibrary"
	mc:Ignorable="d"
	d:DesignHeight="500" d:DesignWidth="900"
	xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" 
	xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
	xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"         
	xmlns:my="clr-namespace:ComponentArt.Silverlight.DataVisualization.Charting;assembly=ComponentArt.Silverlight.DataVisualization.Charting" 
	xmlns:my1="clr-namespace:ComponentArt.Silverlight.DataVisualization.Utils;assembly=ComponentArt.Silverlight.DataVisualization.Common"
	xmlns:dvCharting="clr-namespace:ComponentArt.Silverlight.DataVisualization.Charting;assembly=ComponentArt.Silverlight.DataVisualization.Charting"
	xmlns:dvCommon="clr-namespace:ComponentArt.Silverlight.DataVisualization.Common;assembly=ComponentArt.Silverlight.DataVisualization.Common"
	DataContext="{Binding Source={StaticResource Locator}, Path=ScatterViewModel}"> 
   <UserControl.Resources>
        <my1:DetachFromVisualTree x:Key="ComponentArt_DashboardPanel_DetachFromVisualTree"/>
        <Style x:Key="DashboardPanelStyle1" TargetType="dvCommon:DashboardPanel">
            <Setter Property="Margin" Value="2"/>
            <Setter Property="HorizontalAlignment" Value="Stretch"/>
            <Setter Property="VerticalAlignment" Value="Stretch"/>
            <Setter Property="FontFamily" Value="Lucida Sans Unicode"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="dvCommon:DashboardPanel">
                        <Grid x:Name="LayoutRoot" DataContext="{x:Null}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="ContentLoadStates">
                                    <VisualState x:Name="ContentLoaded">
                                        <Storyboard>
                                            <DoubleAnimation BeginTime="00:00:00" Duration="00:00:00.2" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Content"/>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="Cover">
                                                <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Collapsed"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="ContentNotLoaded">
                                        <Storyboard>
                                            <DoubleAnimation BeginTime="00:00:00" Duration="00:00:00.2" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Content"/>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="Cover">
                                                <DiscreteObjectKeyFrame KeyTime="00:00:00.2" Value="Visible"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Border BorderThickness="0" CornerRadius="4">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="*"/>
                                    </Grid.RowDefinitions>
                                    <ContentPresenter ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{Binding}" HorizontalAlignment="Stretch" Height="23" Margin="8,3" Grid.Row="0" Visibility="{TemplateBinding HeaderVisibility}" VerticalAlignment="Stretch" OpacityMask="Black"/>
                                    <Grid Grid.Row="1">
                                        <Border CornerRadius="0,0,4,4" d:IsHidden="True"/>
                                        <ContentPresenter x:Name="Content" HorizontalAlignment="Stretch" Margin="2,2" Opacity="0" VerticalAlignment="Stretch"></ContentPresenter>
                                        <Grid x:Name="Cover" Background="Transparent" IsHitTestVisible="True" d:IsHidden="True"/>
                                    </Grid>
                                </Grid>
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="HeaderTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Grid>
                            <StackPanel Grid.Column="0" HorizontalAlignment="Center" Orientation="Horizontal" VerticalAlignment="Center">
                                <TextBlock Foreground="#000" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" LineStackingStrategy="BlockLineHeight" LineHeight="20"  Text="{Binding Title}"/>
                                <TextBlock Foreground="{Binding AccentBrush}" FontSize="9" LineStackingStrategy="BlockLineHeight" LineHeight="20" Margin="0,0,3,0" Text="{Binding SubTitle}"/>
                            </StackPanel>
                            <ContentPresenter ContentTemplate="{x:Null}" Content="{Binding HeaderContent, Converter={StaticResource ComponentArt_DashboardPanel_DetachFromVisualTree}}" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
                        </Grid>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White" MouseRightButtonDown="LayoutRoot_MouseRightButtonDown" 
		  MouseLeftButtonDown="LayoutRoot_MouseLeftButtonDown">

		<Grid x:Name="GadgetWindow" Background="White" MinWidth="450" >
			<Grid.RowDefinitions>
        		<RowDefinition Height="50"/>
        		<RowDefinition/>
        	</Grid.RowDefinitions>
        	<Grid.ColumnDefinitions>
        		<ColumnDefinition Width="Auto"/>
        		<ColumnDefinition/>
        	</Grid.ColumnDefinitions>
			<Rectangle x:Name="GWindow" Style="{StaticResource GWindow}" Stroke="{StaticResource WindowBrush}" StrokeThickness="4" Grid.RowSpan="2" Grid.ColumnSpan="2" />
			<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Margin="13,11,0,0" d:LayoutOverrides="VerticalAlignment, GridBox">
				<TextBlock x:Name="tbChartName" TextWrapping="Wrap" Text="Scatter" VerticalAlignment="Top" Margin="0,0,26,0" Height="Auto" HorizontalAlignment="Left" Foreground="#FF2B4360" FontSize="21.333"/>

				<Rectangle x:Name="GHeader" VerticalAlignment="Top" Height="4" Margin="0,2,0,0" StrokeThickness="0" Fill="#FF00B050" />
                
            </StackPanel>
			<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" VerticalAlignment="Top" Margin="180,9,10,0" Grid.Column="1">
				<Button x:Name="FilterButton" Content=""  Template="{StaticResource FilterButton}" Cursor="Hand" Click="FilterButton_Click" Width="24" Height="24" IsEnabled="False" >
					<Button.Effect>
						<DropShadowEffect Color="#FFB0B0B0" ShadowDepth="1"/>
					</Button.Effect>
				</Button>
                <Button x:Name="HeaderButton" Content="" Template="{StaticResource HeaderButton}" Cursor="Hand" Click="HeaderButton_Click"  Width="24" Height="24"  IsEnabled="False" >
					<Button.Effect>
						<DropShadowEffect Color="#FFB0B0B0" ShadowDepth="1"/>
					</Button.Effect>
				</Button>
				<Button x:Name="ResizeButton" Content="" Template="{StaticResource resizebtn}" Cursor="Hand" Click="ResizeButton_Click" Width="24" Height="24" >
					<Button.Effect>
						<DropShadowEffect Color="#FFB0B0B0" ShadowDepth="1"/>
					</Button.Effect>
				</Button>
				<Button x:Name="CloseButton" Content="" Template="{StaticResource CloseButton}" Cursor="Hand" Click="CloseButton_Click" Width="24" Height="24" >
					<Button.Effect>
						<DropShadowEffect Color="#FFB0B0B0" ShadowDepth="1"/>
					</Button.Effect>
				</Button>
			</StackPanel>

			<Grid x:Name="GadgetContentGrid" Grid.Row="1" MinHeight="30" Margin="0,5,0,0" Grid.ColumnSpan="2">
				<toolkit:Expander Margin="0,-45,131,0" VerticalAlignment="Top"  x:Name="gadgetExpander"
					ExpandDirection="Down" IsExpanded="True" Style="{StaticResource ExpanderStyle2}" Canvas.ZIndex="999" HorizontalAlignment="Right" Width="188">
					<toolkit:Expander.Header>
						<TextBlock Text="Edit Properties" FontFamily="Segoe UI" Cursor="Hand" FontSize="13.333" FontWeight="Normal" Foreground="White"/>
					</toolkit:Expander.Header>
					<Grid Background="#FF5C53AC" Margin="0,-2,1,10" Width="178" HorizontalAlignment="Right">
						<StackPanel Margin="2,3,2,0" VerticalAlignment="Top" HorizontalAlignment="Left">
							<StackPanel x:Name="pnlScatterConfig" Visibility="Visible" HorizontalAlignment="Center" Margin="5,0,4,0" Width="163">
								<TextBlock HorizontalAlignment="Left" TextAlignment="Center" Text="X-Axis Field:" Margin="0,5,0,0" Foreground="White"  />
								<ComboBox x:Name="cbxScatterXAxisField" HorizontalAlignment="Left" Width="161" SelectedIndex="0" />
								<TextBlock HorizontalAlignment="Left" TextAlignment="Center" Text="Outcome Field:" Margin="0,5,0,0" Foreground="White"  />
								<ComboBox x:Name="cbxScatterYAxisField" HorizontalAlignment="Left" Width="161" SelectedIndex="0" />
							</StackPanel>
							<StackPanel x:Name="pnlSingleConfig" Visibility="Collapsed">
								<TextBlock HorizontalAlignment="Left" TextAlignment="Center" Text="Primary Field:" Margin="0,5,0,0"  />
								<ComboBox x:Name="cbxSingleField" HorizontalAlignment="Left" Width="140" SelectedIndex="0" />
								<TextBlock HorizontalAlignment="Left" TextAlignment="Center" Text="Weight Field:" Margin="0,5,0,0"  />
								<ComboBox x:Name="cbxWeightField" HorizontalAlignment="Left" Width="140" SelectedIndex="0" />
								<TextBlock x:Name="tblockStrataField"  HorizontalAlignment="Left" TextAlignment="Center" Text="Stratify By:" Margin="0,5,0,0"  />
								<ComboBox x:Name="cbxStrataField" HorizontalAlignment="Left" Width="140" SelectedIndex="0" />
								<TextBlock HorizontalAlignment="Left" TextAlignment="Center" Text="Chart size:" Margin="0,5,0,0"  />
								<ComboBox x:Name="cbxChartSize" HorizontalAlignment="Left" Width="140" SelectedIndex="0" />
								<!--<CheckBox x:Name="checkboxAllValues" Margin="0,5,0,0" Content="Display all list values"  HorizontalAlignment="Left" IsEnabled="false"/>-->
							</StackPanel>
							<Button x:Name="btnRun" Margin="0,11,0,9" Click="btnRun_Click" Content="Run Gadget" Style="{StaticResource btnSec}" HorizontalAlignment="Center" Width="105" Height="28"/>
						</StackPanel>
					</Grid>
				</toolkit:Expander>

				<StackPanel x:Name="spContent" Orientation="Vertical" Margin="10" Visibility="Collapsed">
					<StackPanel x:Name="pnlStatus" Height="58" MaxHeight="40" Width="Auto" Background="#FFf8d7e2" Visibility="Collapsed" VerticalAlignment="Top" Margin="0,5">
						<StackPanel x:Name="pnlStatusTop" Height="2" Width="Auto" Background="#FFe4658e"/>
						<Image x:Name="ErrorIcon" Source="../../Images/error.png" Width="18" Height="18" HorizontalAlignment="Left" Margin="5,1,5,0" VerticalAlignment="Center"/>
						<TextBlock x:Name="txtStatus" Text="Error: Exception occurred." TextWrapping="Wrap" Margin="30,-15,5,5" HorizontalAlignment="Left" FontWeight="Bold" VerticalAlignment="Center"/>
					</StackPanel>
					<StackPanel x:Name="panelMain" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0">
                        <TextBlock x:Name="tbGadgetDescription" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="3,3,0,6" Visibility="Visible" MaxWidth="650" Padding="0,0,10,0" />
                        
                        <Grid x:Name="grdChart" HorizontalAlignment="Left"  VerticalAlignment="Top" Margin="0,10,0,0">
							<StackPanel x:Name="pnlChartContainer" Visibility="Visible" HorizontalAlignment="Left" VerticalAlignment="Top">
                                
								<!--<dvCharting:XYChart x:Name="Chart1" XPath="Low" -->
								<!-- Marker series -->
								<!--<dvCharting:MarkerSeries YPath="Close" Marker="Triangle" />-->
								<!-- Line series -->
								<!--<dvCharting:LineSeries YPath="High" />-->
								<!--</dvCharting:XYChart>-->
							</StackPanel>
						</Grid>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
                            <TextBlock x:Name="lblNumberOfRecords" Text="N = " HorizontalAlignment="Left" VerticalAlignment="Top" d:LayoutOverrides="VerticalAlignment" Margin="0,0,6,15" Height="18" Visibility="Visible"/>
                            <TextBlock x:Name="tbNumberOfRecords" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0" Visibility="Visible"  />
                        </StackPanel>
                    </StackPanel>
				</StackPanel>
				<Grid x:Name="waitCursor" Background="#36C4C4C4" Height="Auto" Visibility="Collapsed">
					<toolkit:BusyIndicator x:Name="BusyIndicator" IsBusy="True" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="100" />
				</Grid>
			</Grid>

		</Grid>
	</Grid>
</UserControl>
